home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OExamples / TESample.r < prev    next >
Encoding:
Text File  |  1993-05-07  |  7.7 KB  |  338 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright © Apple Computer, Inc. 1989-1990
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89    MPW 3.1
  18. #                1.03                02/90    MPW 3.2
  19. #
  20. #    Components:
  21. #                TESample.p            Feb.  1, 1990
  22. #                TESampleGlue.a        Feb.  1, 1990
  23. #                TESample.r            Feb.  1, 1990
  24. #                TESample.h            Feb.  1, 1990
  25. #                TESample.make        Feb.  1, 1990
  26. #
  27. #    TESample is an example application that demonstrates how 
  28. #    to initialize the commonly used toolbox managers, operate 
  29. #    successfully under MultiFinder, handle desk accessories and 
  30. #    create, grow, and zoom windows. The fundamental TextEdit 
  31. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  32. #    also shows how to create and maintain scrollbar controls.
  33. #
  34. #    It does not by any means demonstrate all the techniques you 
  35. #    need for a large application. In particular, Sample does not 
  36. #    cover exception handling, multiple windows/documents, 
  37. #    sophisticated memory management, printing, or undo. All of 
  38. #    these are vital parts of a normal full-sized application.
  39. #
  40. #    This application is an example of the form of a Macintosh 
  41. #    application; it is NOT a template. It is NOT intended to be 
  42. #    used as a foundation for the next world-class, best-selling, 
  43. #    600K application. A stick figure drawing of the human body may 
  44. #    be a good example of the form for a painting, but that does not 
  45. #    mean it should be used as the basis for the next Mona Lisa.
  46. #
  47. #    We recommend that you review this program or Sample before 
  48. #    beginning a new application. Sample is a simple app. which doesn’t 
  49. #    use TextEdit or the Control Manager.
  50. #
  51. ------------------------------------------------------------------------------*/
  52.  
  53. #include "systypes.r"
  54. #include "types.r"
  55.  
  56. #include "TESample.h"
  57.  
  58. resource 'vers' (1) {
  59.     0x02, 0x00, release, 0x00,
  60.     verUS,
  61.     "1.03",
  62.     "1.03, Copyright \251 Apple Computer, Inc. 1989-1990"
  63. };
  64.  
  65. /* we use an MBAR resource to conveniently load all the menus */
  66.  
  67. resource 'MBAR' (rMenuBar, preload) {
  68.     { mApple, mFile, mEdit };        /* three menus */
  69. };
  70.  
  71.  
  72. resource 'MENU' (mApple, preload) {
  73.     mApple, textMenuProc,
  74.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  75.     enabled, apple,
  76.     {
  77.         "About TESample\311",
  78.             noicon, nokey, nomark, plain;
  79.         "-",
  80.             noicon, nokey, nomark, plain
  81.     }
  82. };
  83.  
  84. resource 'MENU' (mFile, preload) {
  85.     mFile, textMenuProc,
  86.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  87.     enabled, "File",
  88.     {
  89.         "New",
  90.             noicon, "N", nomark, plain;
  91.         "Open",
  92.             noicon, "O", nomark, plain;
  93.         "-",
  94.             noicon, nokey, nomark, plain;
  95.         "Close",
  96.             noicon, "W", nomark, plain;
  97.         "Save",
  98.             noicon, "S", nomark, plain;
  99.         "Save As\311",
  100.             noicon, nokey, nomark, plain;
  101.         "Revert",
  102.             noicon, nokey, nomark, plain;
  103.         "-",
  104.             noicon, nokey, nomark, plain;
  105.         "Page Setup\311",
  106.             noicon, nokey, nomark, plain;
  107.         "Print\311",
  108.             noicon, nokey, nomark, plain;
  109.         "-",
  110.             noicon, nokey, nomark, plain;
  111.         "Quit",
  112.             noicon, "Q", nomark, plain
  113.     }
  114. };
  115.  
  116. resource 'MENU' (mEdit, preload) {
  117.     mEdit, textMenuProc,
  118.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  119.     enabled, "Edit",
  120.      {
  121.         "Undo",
  122.             noicon, "Z", nomark, plain;
  123.         "-",
  124.             noicon, nokey, nomark, plain;
  125.         "Cut",
  126.             noicon, "X", nomark, plain;
  127.         "Copy",
  128.             noicon, "C", nomark, plain;
  129.         "Paste",
  130.             noicon, "V", nomark, plain;
  131.         "Clear",
  132.             noicon, nokey, nomark, plain
  133.     }
  134. };
  135.  
  136.  
  137. /* this ALRT and DITL are used as an About screen */
  138.  
  139. resource 'ALRT' (rAboutAlert, purgeable) {
  140.     {40, 20, 160, 296}, rAboutAlert, {
  141.         OK, visible, silent;
  142.         OK, visible, silent;
  143.         OK, visible, silent;
  144.         OK, visible, silent
  145.     };
  146. };
  147.  
  148. resource 'DITL' (rAboutAlert, purgeable) {
  149.     { /* array DITLarray: 5 elements */
  150.         /* [1] */
  151.         {88, 184, 108, 264},
  152.         Button {
  153.             enabled,
  154.             "OK"
  155.         },
  156.         /* [2] */
  157.         {8, 8, 24, 274},
  158.         StaticText {
  159.             disabled,
  160.             "MultiFinder-Aware TextEdit Application"
  161.         },
  162.         /* [3] */
  163.         {32, 8, 48, 295},
  164.         StaticText {
  165.             disabled,
  166.             "Copyright \251 Apple Computer 1989-1990"
  167.         },
  168.         /* [4] */
  169.         {56, 8, 72, 136},
  170.         StaticText {
  171.             disabled,
  172.             "Brought to you by:"
  173.         },
  174.         /* [5] */
  175.         {80, 24, 112, 167},
  176.         StaticText {
  177.             disabled,
  178.             "Macintosh Developer  Technical Support"
  179.         }
  180.     }
  181. };
  182.  
  183.  
  184. /* this ALRT and DITL are used as an error screen */
  185.  
  186. resource 'ALRT' (rUserAlert, purgeable) {
  187.     {40, 20, 150, 260},
  188.     rUserAlert,
  189.     { /* array: 4 elements */
  190.         /* [1] */
  191.         OK, visible, silent,
  192.         /* [2] */
  193.         OK, visible, silent,
  194.         /* [3] */
  195.         OK, visible, silent,
  196.         /* [4] */
  197.         OK, visible, silent
  198.     }
  199. };
  200.  
  201.  
  202. resource 'DITL' (rUserAlert, purgeable) {
  203.     { /* array DITLarray: 3 elements */
  204.         /* [1] */
  205.         {80, 150, 100, 230},
  206.         Button {
  207.             enabled,
  208.             "OK"
  209.         },
  210.         /* [2] */
  211.         {10, 60, 60, 230},
  212.         StaticText {
  213.             disabled,
  214.             "Error. ^0."
  215.         },
  216.         /* [3] */
  217.         {8, 8, 40, 40},
  218.         Icon {
  219.             disabled,
  220.             2
  221.         }
  222.     }
  223. };
  224.  
  225.  
  226. resource 'WIND' (rDocWindow, preload, purgeable) {
  227.     {64, 60, 314, 460},
  228.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  229. };
  230.  
  231.  
  232. resource 'CNTL' (rVScroll, preload, purgeable) {
  233.     {-1, 385, 236, 401},
  234.     0, visible, 0, 0, scrollBarProc, 0, ""
  235. };
  236.  
  237.  
  238. resource 'CNTL' (rHScroll, preload, purgeable) {
  239.     {235, -1, 251, 386},
  240.     0, visible, 0, 0, scrollBarProc, 0, ""
  241. };
  242.  
  243. resource 'STR#' (kErrStrings, purgeable) {
  244.     {
  245.     "You must run on 512Ke or later";
  246.     "Application Memory Size is too small";
  247.     "Not enough memory to run TESample";
  248.     "Not enough memory to do Cut";
  249.     "Cannot do Cut";
  250.     "Cannot do Copy";
  251.     "Cannot exceed 32,000 characters with Paste";
  252.     "Not enough memory to do Paste";
  253.     "Cannot create window";
  254.     "Cannot exceed 32,000 characters";
  255.     "Cannot do Paste"
  256.     }
  257. };
  258.  
  259. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  260.  
  261. resource 'SIZE' (-1) {
  262.     dontSaveScreen,
  263.     acceptSuspendResumeEvents,
  264.     enableOptionSwitch,
  265.     canBackground,                /* we can background; we don't currently, but our sleep value */
  266.                                 /* guarantees we don't hog the Mac while we are in the background */
  267.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  268.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  269.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  270.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  271.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  272.     reserved,
  273.     reserved,
  274.     reserved,
  275.     reserved,
  276.     reserved,
  277.     reserved,
  278.     reserved,
  279.     kPrefSize * 1024,
  280.     kMinSize * 1024    
  281. };
  282.  
  283.  
  284. type 'MOOT' as 'STR ';
  285.  
  286.  
  287. resource 'MOOT' (0) {
  288.     "MultiFinder-Aware TextEdit Sample Application"
  289. };
  290.  
  291.  
  292. resource 'BNDL' (128) {
  293.     'MOOT',
  294.     0,
  295.     {
  296.         'ICN#',
  297.         {
  298.             0, 128
  299.         },
  300.         'FREF',
  301.         {
  302.             0, 128
  303.         }
  304.     }
  305. };
  306.  
  307.  
  308. resource 'FREF' (128) {
  309.     'APPL',
  310.     0,
  311.     ""
  312. };
  313.  
  314.  
  315. resource 'ICN#' (128) {
  316.     { /* array: 2 elements */
  317.         /* [1] */
  318.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  319.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  320.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  321.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  322.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  323.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  324.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  325.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  326.         /* [2] */
  327.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  328.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  329.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  330.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  331.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  332.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  333.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  334.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  335.     }
  336. };
  337.  
  338.